package org.jsets.fastboot.flowable.model.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.javers.core.metamodel.annotation.Id;
import org.jsets.fastboot.flowable.model.dto.DingModelNode;
import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

/**
 * 聚合流程模型
 *
 * @author wangjie (https://github.com/wj596)
 * @date 2021.05.07 21:49
 */
@Data
@ToString
@TableName("sys_composite_model")
@ApiModel(description = "聚合流程模型")
public class CompositeModel implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Id
	@JsonSerialize(using = ToStringSerializer.class)
	@ApiModelProperty(value = "主键")
	private String id;
	
	private String modelKey;
	
	private String name;
	
	private Integer version;
	
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date createTime;
	
	private String deploymentId;
	
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date deploymentTime;
	private Boolean dingModel;
	private String dingEditorJson;
	private String actDeModelId;//act_de_model
	private String actReModelId;//act_re_model
	
	@ApiModelProperty(value = "绑定的表单主键")
	@JsonSerialize(using = ToStringSerializer.class)
	private Long formId;
	private String startedWebhook;// 流程开始回调地址
	private String completedWebhook;// 流程结束回调地址
	private Boolean firstNodeAutoComplete;// 自动完成第一个节点(通常为编辑申请单)

	//=============非持久化属性=============
	@TableField(exist = false)
	private List<DingModelNode> nodes;
	@TableField(exist = false)
	private List<CompositeElement> elements;
}
